<?php

namespace App\Notifications\Channels;

use App\Models\Message;
use Illuminate\Notifications\Notification;

/**
 * 商家消息频道
 * User: ownfi
 * Date: 2017-04-05
 * Time: 12:29
 */
class MerchantMessageChannel
{

    /**
     * 发送给定通知
     * @param $notifiable
     * @param Notification $notification
     */
    public function send($notifiable, Notification $notification)
    {
        list($title,$message) = $notification->messageToMerchant($notifiable);

        Message::create([
            'me_id'=>$notifiable->me_id,
            'title'=>$title,
            'content'=>$message,
        ]);
    }

}